'use strict';
const getdate = require("getdate")
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let {text,imgUrl} = event

  if(text){
    const db = uniCloud.database()
    let date = getdate()
    const dbRes = await db.collection("saying").add([{'text':text,'imgUrl':imgUrl,'time':date}])
    return {
      Code:1,
      data : dbRes.result
    }
  }
  else
  return {
    Code: 0,
    errMsg: 'text不能为空'
  }
 
	//返回数据给客户端
};


